package com.three.box.network

import com.three.box.config.Constant
import com.three.box.helper.LogUtils
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException

class HeaderInterceptor : Interceptor {
    @Throws(IOException::class)
    override fun intercept(chain: Interceptor.Chain): Response {
        // 添加请求头（公共参数）
        val request = chain.request().newBuilder()
            .header("Authorization", "Bearer ${Constant.token()}")
            .build()
        LogUtils.d("HeaderInterceptor", request.headers().toString())
        return chain.proceed(request)
    }
}